const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 1; i <= 20; i++) content.push({
        id: `${i}`,
        dealerCode: `dealerCode${i}`,
        dealerName: '奇瑞国际',
        brandCode: `brandCode${i}`,
        brandName: '奇瑞',
        partSaleOrderCode: 'partSaleOrderCode1, partSaleOrderCode2, partSaleOrderCode3, partSaleOrderCode4',
        code: 'code',
        partInvoiceCode: 'partInvoiceCode1',
        partContractInvoiceStatus: 1,
        invoicedDate: '2017-07-01',
        rowVersion: 'string',
        options: [
            'declare',
            'clearancet'
        ]
    });
    res.json(
        {
            message: '',
            payload: {
                content,
                totalElements: 100,
            }
        }
    );
});


const details = [];
for(let i = 1; i < 12; i++)
    details.push({
        id: `${i}`,
        partId: `string${i}`,
        partCode: `string${i}`,
        partName: `string${i}`,
        shipQuantity: i * 2,
        confirmQuantity: i
    });

router.get('/:id', (req, res) => {
    res.json({
        payload: {
            id: 'id1',
            brandCode: 'brandCode',
            dealerCode: 'dealerCode',
            code: 'code',
            invoicedDate: 'invoicedDate',
            partContractInvoiceCode: 'partContractInvoiceCode',
            partInvoiceCode: 'partInvoiceCode',
            shipmentType: 1,
            origin: 'origin',
            destination: 'destination',
            shipmentDate: 'shipmentDate',
            expectShipmentDate: 'expectShipmentDate',
            expectDepartedDate: 'expectDepartedDate',
            actualDepartedDate: 'actualDepartedDate',
            expectArrivalDate: 'expectArrivalDate',
            actualArrivalDate: 'actualArrivalDate',
            lcCode: 'lcCode',
            declarePlace: 1,
            declareType: 1,
            shortContainerCount: 150,
            standardContainerCount: 120,
            highContainerCount: 50,
            isLCL: true,
            remark: 'remark',
            rowVersion: 'string',
            options: [
                'declare',
                'clearancet'
            ],
            declareAttachments: [
                {
                    fileId: 'declareId',
                    fileName: '下载报关附件清单1'
                }
            ],
            clearanceAttachments: [
                {
                    fileId: 'clearanceId',
                    fileName: '下载清关附件清单1'
                }
            ]
        }
    });
});


router.put('/:id/declare', (req, res) => {
    res.json({
        message: 'success'
    });
});

router.put('/:id/clearance', (req, res) => {
    res.json({
        message: 'success'
    });
});

router.get('/forCurrentUser/export', (req, res) => {
    res.json({
        message: 'success',
        payload: 'Mock导出'
    });
});

module.exports = router;
